home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 1 / CU Amiga Magazine CD-ROM Special Edition (1995)(EMAP Images)(GB)[Issue 1995-11].iso / Aminet / comm / tcp / archie38_1.lha / archie-1.4 / amiga / getuid.c < prev   
C/C++ Source or Header  |  1995-01-05  |  635b  |  33 lines

  1. /* Amiga port by Tomas Willis (tomas@cae.wisc.edu) January 1995 */
  2. /* This is my little routine to trick up the AmiTCP uid.
  3.  * Why this isn't a standar funciton, I don't know.  I probably
  4.  * missed something in the docs. --tcw
  5.  */
  6. /* Amiga port by Tomas Willis (tomas@cae.wisc.edu) January 1995 */
  7.  
  8. #include <pwd.h>
  9. #include <stdlib.h>
  10. #include <string.h>
  11.  
  12. //protos
  13. unsigned long getuid(void);
  14.  
  15. unsigned long
  16. getuid(void)
  17. {
  18. struct passwd *pw=NULL;
  19. char *un=NULL;
  20. ULONG uid = 1;
  21.  
  22.   un = getenv("USERNAME");
  23.   if (0 != strlen(un)) {
  24.     pw = getpwnam(un);
  25.     if (NULL != pw) {
  26.       uid = pw->pw_uid;
  27.     }  
  28.   }  
  29.   return(uid);
  30. }
  31.  
  32.  
  33.